//
//  ZSY_RecommendViewController.m
//  ZSY_BreadTrip
//
//  Created by 张诗宇 on 16/1/14.
//  Copyright © 2016年 张诗宇. All rights reserved.
//

#import "ZSY_RecommendViewController.h"

@interface ZSY_RecommendViewController ()
@property (nonatomic, retain) UIWebView *webView;


@end

@implementation ZSY_RecommendViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.navigationController.navigationBar setTranslucent:NO];
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"account_uploadavatar_btn"] forBarMetrics:UIBarMetricsDefault];
    self.navigationItem.title = @"精品旅行工具应用";
    
    self.view.backgroundColor = [UIColor colorWithRed:248 / 255.0 green:243 / 255.0 blue:233 / 255.0 alpha:1];
    
    
    CGRect frame = self.view.frame;
    frame.size.height -= 64;
    
    self.webView = [[UIWebView alloc] initWithFrame:frame];
    
    NSString *string = [NSString stringWithFormat:@"http://web.breadtrip.com/featured_apps/"];
    
    NSURL *url = [NSURL URLWithString:string];
    NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
    [self.webView loadRequest:request];
    
    [self.view addSubview:self.webView];
    [_webView release];
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"add_new_poi_back_btn"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStyleDone target:self action:@selector(backAction)];

}

- (void)backAction{
    
    if ([self.webView canGoBack]) {
        
        [self.webView goBack];
    }else{
        
        [self.navigationController popViewControllerAnimated:YES];
    }
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
